import Vue from 'vue'
import Router from 'vue-router'
import Home from './pages/home'
import Index from './pages/index'
const Product = ()=> import('./pages/product')  
const Detail = ()=> import('./pages/detail')  
const Cart = ()=> import('./pages/cart')  
const Login = ()=> import('./pages/login')  
const Order = ()=> import('./pages/order')  
const OrderConfirm = ()=> import('./pages/orderConfirm')  
const OrderList = ()=> import('./pages/orderList')  
const OrderPay = ()=> import('./pages/orderPay')  
const Alipay = ()=> import('./pages/alipay')  

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'home',
      component: Home,
      redirect: '/index',
      children: [
        {
          path: '/index',
          name: 'index',
          component: Index
        },
        {
          path: '/product/:id',
          name: 'product',
          component: Product
        },
        {
          path: '/detail/:id',
          name: 'detail',
          component: Detail
        }
      ]
    },
    {
      path: '/cart',
      name: 'cart',
      component: Cart
    },
    {
      path: '/login',
      name: 'login',
      component: Login
    },
    {
      path: '/order',
      name: 'order',
      component: Order,
      children: [
        {
          path: 'list',
          name: 'order-list',
          component: OrderList
        },
        {
          path: 'confirm',
          name: 'order-confirm',
          component: OrderConfirm
        },
        {
          path: 'pay',
          name: 'order-pay',
          component: OrderPay
        },
        {
          path: 'alipay',
          name: 'alipay',
          component: Alipay
        }
      ]
    }
  ]
})
